package com.example.service.Impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.Emp5;
import com.example.mapper.emp5Mapper;
import com.example.service.IEmp5Service;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class emp5ServiceImpl extends ServiceImpl<emp5Mapper, Emp5> implements IEmp5Service {

    @Autowired
    emp5Mapper emp5Mapper;

    @Override
    public IPage<Emp5> selectPage(int currentPage,int pageSize,Emp5 emp5) {
        LambdaQueryWrapper<Emp5> wrapper=new LambdaQueryWrapper<Emp5>();
        wrapper.like(Strings.isNotEmpty(emp5.getName()),Emp5::getName,emp5.getName());
        wrapper.like(emp5.getDeptID()!=null,Emp5::getDeptID,emp5.getDeptID());
        wrapper.like(emp5.getSalary()!=null,Emp5::getSalary,emp5.getSalary());
        Page page = new Page(currentPage, pageSize);
        IPage ipage = emp5Mapper.selectPage(page, wrapper);
        return ipage;
    }
}
